SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[Tv_Get_TvShows]
AS
Select T.Id, T.Title, Count(EpisodeId) AS Episodes, T.Rating, T.BannerImage  
FROM tvshow_episodes E
inner join Tv T on T.Id = E.TvId
WHERE SeasonId <> 0 and E.rating <> -99
Group By T.Id, T.Title, T.Rating, T.BannerImage
Order by T.Title ASC
GO
